package com.meta.platform.file.service;

import com.meta.framework.core.ResponseVo;
import com.meta.platform.file.config.OssServiceFactory;
import com.meta.platform.file.model.FileInfo;
import com.meta.platform.file.model.FileType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

/**
 * java类简单作用描述
 *
 * @Title:
 * @Package: com.meta.platform.file.service.
 * @Author: M.simple
 * @Remark: The modified content
 * @CreateDate: 2023/12/4 17:26
 * @Version: v2.0
 */
@Service
public class UploadService {


    @Autowired
    private OssServiceFactory fileServiceFactory;

    public FileInfo upload(MultipartFile file){

        // 原来本地上传改成阿里云上传
        String fileType = FileType.ALIYUN.toString();
        IFileService fileService = fileServiceFactory.getFileService(fileType);

        return fileService.upload(file);
    }

    public FileInfo upload(byte[] file, String fileName) {

        // 原来本地上传改成阿里云上传
        String fileType = FileType.ALIYUN.toString();
        IFileService fileService = fileServiceFactory.getFileService(fileType);

        return fileService.upload(file, fileName);
    }
}
